<template>
	<view>
		<view class="pad-lr-30 hetop">
			<view class="pad-lr-10 mar-top-20 radius-16 my_bi_view over-hid">
				<view class="col-f fontSize-30 text-align-center mar-top-50">我的推荐码</view>
				<view class="col-f fontSize-32 text-align-center mar-top-50 fontBold">{{num}}</view>
			</view>
			<view class="mar-top-40 fontSize-32 display-sb align-items">
				<view class="fontBold">推荐码明细</view>
				<view class="display align-items" @click="openshowwin">
					<image src="/static/img/icon_shaixuanshijian.png" class="proudct-item-icon-24" mode=""></image>
					<view class="ml10 fontSize-28 col-6">筛选时间</view>
				</view>
			</view>
			<view class="pad-tb-30 bordbottom display-sb align-items" v-for="item in list" :key="item.id">
				<view class="">
					<view class="fontSize-28">{{item.memo}}</view>
					<view class="mar-top-8 col-9 fontSize-26">{{item.create_time_text}}</view>
				</view>
				<view class="fontSize-32">{{item.coin_num}}</view>
			</view>
			<view class="display-ce align-items" v-if="list.length==0">
				<tm-result :showBtn="false" subTitle=" " title="暂无数据" color="#2DB295"></tm-result>
			</view>
		</view>
		
		
		<tm-time-picker
					:showDetail="{
						year: true,
						month: true,
						day: false,
						hour: false,
						minute: false,
						second: false
					}"
					v-model:show="show"
					v-model="data"
					:defaultValue="data"
					format="YYYY-MM-DD"
					v-model:model-str="data"
					@confirm="confirm"
				></tm-time-picker>
	</view>
</template>

<script lang="ts" setup>
import {coinLog} from '@/utils/api'
import { onLoad } from '@dcloudio/uni-app';
import { ref } from 'vue';
onLoad((p)=>{
	num.value = p.num
	_my_payments_code()
})
const num = ref(0)
const data = ref()
const list = ref([])
const page = ref(1)
const show = ref(false)
const _my_payments_code =() =>{
	coinLog({page:page.value,limit:10,date:data.value}).then(res=>{
		uni.hideLoading()
		if(res.code==1){
			list.value =list.value.concat(res.data.money_log.data)
			if(res.data.money_log.data.length>0){
				page.value++
			}
		}
	})
}
const _sales_index = () =>{
	page.value = 1
	list.value = []
	show.value = false
	_my_payments_code()
}

const openshowwin = () =>{
	show.value = true
}
const confirm =(e) =>{
		uni.showLoading({
			title:'加载中...'
		})
	show.value = false
	setTimeout(()=>{
	_sales_index()
	},1000)
}
</script>

<style lang="scss">
.my_bi_view{
	height: 240rpx;
	background: linear-gradient( 180deg, #F6911B 0%, #F8C44A 100%);
}
.bordbottom{
	border-bottom: 2rpx solid #F1F1F1;
}
.time_view{
	width: 270rpx;
	background: #F9F9F9;
}
.btn_qury{
	width: 600rpx;
	height: 80rpx;
	background: linear-gradient(270deg, #bc8c1e 0%, #fdfdfd 100%);
	margin: 100rpx auto 0 auto;
	line-height: 80rpx;
}
</style>
